package sprite;

import java.awt.Color;

import java.util.LinkedList;

/**
 * @author timondavis@yahoo.com
 *  
 * Tetro T is a t shaped tetro,
 * and a t shaped tetro is he...
 */
public class TetroT extends Tetromino{

  private final Color core = Color.GREEN;
  private final Color s1   = Color.YELLOW;
  private final Color s2   = Color.GRAY;
  
  public TetroT(int x, int y, int width, int height) {
    super(width, height);
    
    setPointX(x);
    setPointY(y);
    
    LinkedList<Tetrobox[][]> rotations = new LinkedList<Tetrobox[][]>();
    
    Tetrobox[][] tetrosquare =  newTetrominoGrid(width, height, 4, 4);
    
    tetrosquare[0][0] = new Tetrobox(0, 0, width, height, true);
    tetrosquare[1][0] = new Tetrobox(1, 0, width, height, true);
    tetrosquare[2][0] = new Tetrobox(2, 0, width, height, true);
    tetrosquare[1][1] = new Tetrobox(1, 1, width, height, true);
    tetrosquare[1][2] = new Tetrobox(1, 2, width, height, true);
    
    tetrosquare[0][0].setColors(core, s1, s2);
    tetrosquare[1][0].setColors(core, s1, s2);
    tetrosquare[2][0].setColors(core, s1, s2);
    tetrosquare[1][1].setColors(core, s1, s2);
    tetrosquare[1][2].setColors(core, s1, s2);
    
    rotations.add(tetrosquare);
    Tetrobox[][] tetrosquare2 =  newTetrominoGrid(width, height, 4, 4);
    
    tetrosquare2[2][0] = new Tetrobox(2, 0, width, height, true);
    tetrosquare2[2][1] = new Tetrobox(2, 1, width, height, true);
    tetrosquare2[2][2] = new Tetrobox(2, 2, width, height, true);
    tetrosquare2[1][1] = new Tetrobox(1, 1, width, height, true);
    tetrosquare2[0][1] = new Tetrobox(0, 1, width, height, true);
    
    tetrosquare2[2][0].setColors(core, s1, s2);
    tetrosquare2[2][1].setColors(core, s1, s2);
    tetrosquare2[2][2].setColors(core, s1, s2);
    tetrosquare2[1][1].setColors(core, s1, s2);
    tetrosquare2[0][1].setColors(core, s1, s2);
    
    
    rotations.add(tetrosquare2);
    Tetrobox[][] tetrosquare3 =  newTetrominoGrid(width, height, 4, 4);
    
    tetrosquare3[1][0].setColors(core, s1, s2);
    tetrosquare3[1][1].setColors(core, s1, s2);
    tetrosquare3[1][2].setColors(core, s1, s2);
    tetrosquare3[0][2].setColors(core, s1, s2);
    tetrosquare3[2][2].setColors(core, s1, s2);
    
    tetrosquare3[1][0].setVisible(true);
    tetrosquare3[1][1].setVisible(true);
    tetrosquare3[1][2].setVisible(true);
    tetrosquare3[0][2].setVisible(true);
    tetrosquare3[2][2].setVisible(true);
    
    rotations.add(tetrosquare3);
    Tetrobox[][] tetrosquare4 =  newTetrominoGrid(width, height, 4, 4);
    
    tetrosquare4[0][0].setColors(core, s1, s2);
    tetrosquare4[0][1].setColors(core, s1, s2);
    tetrosquare4[0][2].setColors(core, s1, s2);
    tetrosquare4[1][1].setColors(core, s1, s2);
    tetrosquare4[2][1].setColors(core, s1, s2);
    
    tetrosquare4[0][0].setVisible(true);
    tetrosquare4[0][1].setVisible(true);
    tetrosquare4[0][2].setVisible(true);
    tetrosquare4[1][1].setVisible(true);
    tetrosquare4[2][1].setVisible(true);
    
    rotations.add(tetrosquare4);
    
    this.setRotations(rotations);
    
    setTetroHeight(3);
    setTetroWidth(3);
    
  }
}

